import {DIC }from '@/const/dic.js';
import {isvalidatemobile,validatenull} from '@/util/validate.js'
const validatePhone = (rule, value, callback) => {
    var  list=isvalidatemobile(value);
    if (!validatenull(value)) {
        if (list[0]) {
            callback(new Error(list[1]));
        } else {
            callback();
        }
    } else {
        callback(new Error(list[1]));
    }

}
export const usrAddressOption = {
    border: true,
    index: true,
    indexLabel: '序号',
    selection: true,
    columnBtn:true,
    refreshBtn:false,
    addBtn:false,
    delBtn:false,
    editBtn:false,
    menuWidth:300,
    menuAlign:'center',
    formWidth: '100%',
    align:'center',
    dicData:DIC,
    stripe:true,
    column: [
    {

                label: "编号",
                prop: "id",
                width: "150",
                fixed: true,
                hide:true,
                addDisplay:false,
                editDisplay:false,
                rules: [{
                    required: true,
                    message: "请输入编号",
                    trigger: "blur"
                }]
            },
            {
                label:"用户名",
                prop:"userId",
                width:"150",
                fixed: true,
                type:"select",
                props: {
                    label: 'userName',
                    value: 'id'
                },
                dicMethod:'get',
                dicUrl:"/shop/usrUser/allList",


            },
        {
            label:"收货人",
            prop:"trueName",
            width:"150",
            fixed: true,
            rules: [{
                required: true,
                message: "请输入收货人姓名",
                trigger: "blur"
            }]
        },
        {
            label:"手机号",
            prop:"telephone",
            width:"150",
            fixed: true,
            rules: [{
                required: true,
                validator: validatePhone,
                trigger: "blur"
            }]
        },
        {
        label:"详细地址",
        prop:"areaInfo",
        width:"150",
            overHidden:true,
       fixed: true,
            rules: [{
                   required: true,
                   message: "请输入详细地址",
                   trigger: "blur"
               }]
        },
        {
        label:"地区id",
        prop:"areaId",
        width:"150",
       fixed: true,
            hide:true,
            rules: [{
                   required: true,
                   message: "请选择地区",
                   trigger: "blur"
               }]
        },
        {
            label:"邮政编码",
            prop:"zip",
            width:"150",
            fixed: true,
            rules: [{
                required: true,
                message: "请输入邮政编码",
                trigger: "blur"
            }]
        },
        {
            label:"是否默认",
            prop:"type",
            width:"150",
            fixed: true,
            type:"switch",
            slot:true,
            dicData:DIC.ADDRESSTYPE,
            mock: {
                type: 'dic'
            },
        },
    ],


};

